package com.group3.controller;

import com.group3.common.result.ApiResponse;
import com.group3.model.LiveRoom;
import com.group3.model.Product;
import com.group3.service.LiveRecommendationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/live/recommendation")
public class LiveRecommendationController {
    @Autowired
    private LiveRecommendationService recommendationService;

    @GetMapping("/list")
    public ApiResponse getLiveRecommendations(@RequestParam Integer uid) {
            if(uid==-1){
                throw new RuntimeException("服务不可用");
            }
        List<LiveRoom> recommendations = recommendationService.getPersonalizedRecommendations(uid);
        return ApiResponse.success(recommendations);
    }
}